<template>
  <div class="tabbar">
    <router-link
      v-for="nav in navs"
      :key="nav.path"
      :to="nav.path"
      tag="div"
      >
      <i class="iconfont" v-html="nav.meta.icon"></i>
      <span>{{nav.meta.title}} </span>
    </router-link>
    <!-- <router-link to="/category" tag="div">
      <i class="iconfont">&#xe618;</i>
      <span>分类</span>
    </router-link>
    <router-link to="/cart" tag="div">
      <i class="iconfont">&#xe63d;</i>
      <span>购物车</span>
    </router-link>
    <router-link to="/mine" tag="div">
      <i class="iconfont">&#xe61c;</i>
      <span>我的</span>
    </router-link> -->
  </div>
</template>

<script>
import routes from '@/router/routes'
export default {
  name: 'Tabbar',
  computed: {
    navs () {
      // return routes.filter(route => route.meta.isNav)
      const rout = routes.filter(route => {
        return route.meta.isNav === true
      })
      return rout
    }
  },
  mounted () {
    console.log(routes)
  }
}
</script>

<style lang="scss" scoped>
  .tabbar {
      display: flex;
      height: 50px;
        i {
          display: inline-block;
          font-size: 25px;
        }
        div {
            flex: 1;
            text-align: center;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }
        .router-link-exact-active, .router-link-active {
          background: #ccc;
        }
  }
</style>
